change_categorical_numerical <- function(
  cat_vec = c("A", "B", "C"),
  num_vec = c(0, 1, 2),
  cell_vec = c()
){
  if(length(cell_vec) == 0){
    cat("You Have to Input cell_vec !\n")
    return("")
  }
  temp_df <- data.frame(cat_vec, num_vec)
  out_vec <- rep(NA, length(cell_vec))
  for(i in 1:length(cell_vec)){
    if(length(unique(cat_vec == cell_vec[i])) != 2){
      cat(cell_vec[i], " is not in the vector!!\n")
      out_vec[i] <- ""
    }else{
      out_vec[i] <- temp_df[temp_df$cat_vec == cell_vec[i], "num_vec"]
    }
  }
  return(out_vec)
}


####Test####

# change_categorical_numerical(cell_vec = c("B", "C", "B"))

# change_categorical_numerical(cell_vec = c("D"))